package com.syezon.wifikey.news;

import android.os.Parcel;
import android.os.Parcelable;

import com.syezon.wifikey.speed.SpeedTestResult;

public class ResultInfo implements Parcelable {

    public static final int TYPE_SHOW_WIFI_INFO = 100;

    public static final int RESULT_TYPE_WIFI_ENHANCE = 1;
    public static final int RESULT_TYPE_WIFI_SAFE = 2;
    public static final int RESULT_TYPE_SPEEDTEST = 3;
    public static final int RESULT_TYPE_SPEED_UP = 4;

    private boolean showResult;
    private int resultType;
    private int add;
    private String ssid;
    private SpeedTestResult speedTestResult;

    public boolean isShowResult() {
        return showResult;
    }

    public void setShowResult(boolean showResult) {
        this.showResult = showResult;
    }

    public int getResultType() {
        return resultType;
    }

    public void setResultType(int resultType) {
        this.resultType = resultType;
    }

    public int getAdd() {
        return add;
    }

    public void setAdd(int add) {
        this.add = add;
    }

    public SpeedTestResult getSpeedTestResult() {
        return speedTestResult;
    }

    public void setSpeedTestResult(SpeedTestResult speedTestResult) {
        this.speedTestResult = speedTestResult;
    }

    public String getSsid() {
        return ssid;
    }

    public void setSsid(String ssid) {
        this.ssid = ssid;
    }

    public ResultInfo() {
    }

    public ResultInfo(int resultType) {
        this.showResult = showResult;
        this.resultType = resultType;
    }

    public ResultInfo(int resultType, int add) {
        this.resultType = resultType;
        this.add = add;
        this.speedTestResult = speedTestResult;
    }

    public ResultInfo(int resultType, String ssid) {
        this.resultType = resultType;
        this.add = add;
        this.speedTestResult = speedTestResult;
    }

    public ResultInfo(int resultType, SpeedTestResult speedTestResult) {
        this.showResult = showResult;
        this.resultType = resultType;
        this.add = add;
        this.speedTestResult = speedTestResult;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte(this.showResult ? (byte) 1 : (byte) 0);
        dest.writeInt(this.resultType);
        dest.writeInt(this.add);
        dest.writeString(this.ssid);
        dest.writeParcelable(this.speedTestResult, flags);
    }

    protected ResultInfo(Parcel in) {
        this.showResult = in.readByte() != 0;
        this.resultType = in.readInt();
        this.add = in.readInt();
        this.ssid = in.readString();
        this.speedTestResult = in.readParcelable(SpeedTestResult.class.getClassLoader());
    }

    public static final Creator<ResultInfo> CREATOR = new Creator<ResultInfo>() {
        @Override
        public ResultInfo createFromParcel(Parcel source) {
            return new ResultInfo(source);
        }

        @Override
        public ResultInfo[] newArray(int size) {
            return new ResultInfo[size];
        }
    };
}
